package com.ww.springboot.system.config;

import com.ww.springboot.system.test.Test1;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.stereotype.Component;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 描述：
 *
 * @author wanwei
 * @since 2021-07-29 11:33
 */
@Component
public class ConfigTest1 {

    @Bean
    public String configTest1(){
        System.out.println("------------configTest1---------------");
        ClassLoader classLoader = this.getClass().getClassLoader();
        // Use names and ensure unique to protect against duplicates
        Set<String> names = new LinkedHashSet<>(SpringFactoriesLoader.loadFactoryNames(ApplicationContextInitializer.class, classLoader));
        System.out.println(names);
        Set<String> names2 = new LinkedHashSet<>(SpringFactoriesLoader.loadFactoryNames(Test1.class, classLoader));
        System.out.println(names2);
        return "";
    }

}
